;;==========================================================================
;; Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
;;==========================================================================

#include <bsp/bspcfg.h>
#include <kcfg.h>

    AREA |.text|,ALIGN=2,CODE, READONLY

    EXPORT  _StartUpEntryBegin
    EXPORT  UserStartUpEntry
    EXPORT  _StartUpEntryEnd

_StartUpEntryBegin
UserStartUpEntry

    mov	ip, sp
    stmdb	sp!, {r5, fp, ip, lr, pc}
    sub	fp, ip, #4	; 0x4
    sub	sp, sp, #8	; 0x8
    ldr	r2, [r1, #4]
    ldr	r3, [r1, #8]
    str	r3, [fp, #-24]
    str	r2, [fp, #-20]
4   ldr	r2, [fp, #-20]
    ldr	r3, [r2, #4]
    cmp	r3, #0	; 0x0
    beq	%f1
    ldr	r3, [fp, #-20]
    ldr	r2, [r3, #4]
    mov	r3, #65280	; 0xff00
    add	r3, r3, #255	; 0xff
    cmp	r2, r3
    bls	%f2
    ldr	r3, [fp, #-20]
    ldr	r2, [r3, #4]
    mvn	r3, #-150994944	; 0xf7000000
    sub	r3, r3, #12582912	; 0xc00000
    cmp	r2, r3
    bhi	%f2
    ldr	r2, [fp, #-20]
    ldr	ip, [r2]
    ldr	r3, [fp, #-20]
    ldr	r0, [r3, #4]
    mov	r1, #0	; 0x0
    mov	r2, #0	; 0x0
    mov	r3, #10	; 0xa
    mov	lr, pc
    mov	pc, ip
    b	%f1
2   ldr	r2, [fp, #-20]
    ldr	r3, [r2]
    ldr	r2, [fp, #-20]
    ldr	r0, [r2, #4]
    ldr	r1, [fp, #-24]
    mov	r2, #0	; 0x0
    mov	lr, pc
    mov	pc, r3
    mov	r3, r0
    cmp	r3, #0	; 0x0
    bne	%f3
    b	%f1
3   ldr	r3, [fp, #-20]
    sub	r3, r3, #8	; 0x8
    str	r3, [fp, #-20]
    b	%b4

1   mov	r0, #0	; 0x0
    mov	r5, #0	; 0x0
    swi	0x0000000b
    sub	sp, fp, #16	; 0x10
    ldmia	sp, {r5, fp, sp, pc}

_StartUpEntryEnd

    END

